package com.paas.form.stat;

import com.paas.form.cache.AttributeCache;
import com.paas.form.cache.ChildViewCache;
import com.paas.form.cache.IDataSourceCache;
import com.paas.form.cache.ViewCache;
import com.paas.form.cache.eh.AttributeCacheEh;
import com.paas.form.cache.eh.ChildViewCacheEh;
import com.paas.form.cache.eh.DataSourceCacheImpl;
import com.paas.form.cache.eh.ViewCacheEh;
import com.paas.form.service.impl.FormServiceImpl;
import com.paas.plus.tool.form.server.FormServer;
import com.paas.plus.tool.form.server.FormServerImpl;
import com.paas.plus.tool.form.server.FormService;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

@Slf4j
@ComponentScan(basePackages={"com.paas.form.controller","com.paas.form.service","com.paas.form.queue","com.paas.form.visualdev.controller","com.paas.form.visualdev.service","com.paas.form.cache"})
@MapperScan(basePackages = {"com.paas.form.dao","com.paas.form.visualdev.dao"})
public class FormAutoConfigure {
    public FormAutoConfigure() {
        log.info("============ form-spring-boot-starter initialization！ ===========");
    }

    @Bean("formServer")
    FormServer createFormServer(){
        return new FormServerImpl();
    }

    @Bean("formService")
    FormService createFormService(){
        return new FormServiceImpl();
    }

    @Bean("viewCache")
    public ViewCache createViewCacheEh() {
        return new ViewCacheEh();
    }

    @Bean("childViewCache")
    public ChildViewCache createChildViewCacheEh() {
        return new ChildViewCacheEh();
    }

    @Bean("attributeCache")
    public AttributeCache createAttributeCacheEh() {
        return new AttributeCacheEh();
    }

    @Bean("dataSourceCache")
    public IDataSourceCache createDataSourceCacheCache() {
        return new DataSourceCacheImpl();
    }
}
